import React, { FC } from "react";
import { Typography } from "antd";
import { QuestionTitleDefaultProps, QuestionTitlePropsType } from "./interface";
const QuestionTitle: FC<QuestionTitlePropsType> = (
  props: QuestionTitlePropsType
) => {
  const { Title } = Typography;
  const { text, isCenter, level=1 } = { ...QuestionTitleDefaultProps, ...props };
  const getFontSize = (level: number) => {
    if (level === 1) return '24px'
    if (level === 2) return '20px'
    if (level === 3) return '16px'
    return '16px'
  }
  return (
    <Title
      level={level}
      style={{
        textAlign: isCenter ? "center" : "start",
        fontSize: getFontSize(level),
      }}
    >
      {text}
    </Title>
  );
};
export default QuestionTitle;
